package com.jc.ds.model;

import java.util.Date;

/**
 * user_token
 * @author 
 */
public class UserToken extends BaseValueObject {
    private Long id;

    /**
     * 用户TOKEN
     */
    private String userToken;

    /**
     * 是否有效
     */
    private String isDelete;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 生成时间
     */
    private Date createTime;

    private String orderStr = null;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUserToken() {
        return userToken;
    }

    public void setUserToken(String userToken) {
        this.userToken = userToken;
    }

    public String getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(String isDelete) {
        this.isDelete = isDelete;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public void orderById(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by id asc";
            }else{
                this.orderStr = this.orderStr + ",id asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by id desc";
            }else{
                this.orderStr = this.orderStr + ",id desc";
            }
        }
    }

    public void orderByUserToken(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by user_token asc";
            }else{
                this.orderStr = this.orderStr + ",user_token asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by user_token desc";
            }else{
                this.orderStr = this.orderStr + ",user_token desc";
            }
        }
    }

    public void orderByIsDelete(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by is_delete asc";
            }else{
                this.orderStr = this.orderStr + ",is_delete asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by is_delete desc";
            }else{
                this.orderStr = this.orderStr + ",is_delete desc";
            }
        }
    }

    public void orderByUserId(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by user_id asc";
            }else{
                this.orderStr = this.orderStr + ",user_id asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by user_id desc";
            }else{
                this.orderStr = this.orderStr + ",user_id desc";
            }
        }
    }

    public void orderByCreateTime(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by create_time asc";
            }else{
                this.orderStr = this.orderStr + ",create_time asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by create_time desc";
            }else{
                this.orderStr = this.orderStr + ",create_time desc";
            }
        }
    }
}